﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GrayParrot.Communications.Core;


namespace GrayParrot.Communications.Messaging
{
    /// <summary>
    /// 
    /// </summary>
    public enum ReadTypes
    {
        GetAll = 0,
        GetUnread
    }

    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class MessageManager : IDisposable
    {
        //MessagesController m_msgC = null;

        /// <summary>
        /// Initializes a new instance of the <see cref="MessageManager"/> class.
        /// </summary>
        public MessageManager()
        {
            //m_msgC = new MessagesController();
        }

        /// <summary>
        /// Gets the messages.
        /// </summary>
        /// <param name="readType">Type of the read.</param>
        /// <returns></returns>
        public List<Message> GetMessages(ReadTypes readType)
        {
            List<Message> retValue = null;

            //switch (readType)
            //{
            //    case ReadTypes.GetAll:
            //        retValue = m_msgC.GetAllMessages();
            //        break;
            //    case ReadTypes.GetUnread:
            //        retValue = m_msgC.GetUnreadMessages();
            //        break;
            //    default:
            //        break;
            //}

            return retValue;
        }

        /// <summary>
        /// Adds a new message...
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="severity">The severity.</param>
        /// <returns></returns>
        public bool AddMessage(string message, MessageSeverity severity)
        {
            bool retValue = false;

            //retValue = m_msgC.SendMessage(message, severity);

            return retValue;
        }

        //public bool DeleteMessage()
        //{
        //    bool retValue = false;

        //    return retValue;
        //}

        /// <summary>
        /// Marks message as read...
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public bool MarkAsRead(Guid id)
        {
            bool retValue = false;

            //retValue = m_msgC.SetMessageRead(id);

            return retValue;
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            //if (m_msgC != null)
            //{
            //    m_msgC.Dispose();
            //    m_msgC = null;
            //}
        }
    }
}
